<template>
  <el-form-item :label="i18nt('designer.setting.displayType')">
    <el-select v-model="optionModel.type" @change="changeType">
      <el-option label="datetime" value="datetime"></el-option>
      <el-option label="date" value="date"></el-option>
      <el-option label="dates" value="dates"></el-option>
      <el-option label="year" value="year"></el-option>
      <el-option label="month" value="month"></el-option>
      <el-option label="week" value="week"></el-option>
    </el-select>
  </el-form-item>
</template>

<script>
  import i18n from "@/components/v-form-design/utils/i18n";
  import {DatetimeFormatOptions} from "@/config/column";

  export default {
    name: "date-type-editor",
    mixins: [i18n],
    props: {
      designer: Object,
      selectedWidget: Object,
      optionModel: Object,
    },
    methods: {
      changeType(type){
        const formatOptions = DatetimeFormatOptions[type];
        this.optionModel.formatOptions = formatOptions
        const defaultFormat = formatOptions[0].value
        this.optionModel.format = defaultFormat
        this.optionModel.valueFormat = defaultFormat
      }
    }
  }
</script>

<style scoped>

</style>
